<template>
  <avue-crud
    ref="managerRef"
    :table-loading="tableLoading"
    v-model="form"
    :option="option"
    @refresh-change="getManager"
    @row-save="rowSave"
    @row-update="rowUpdate"
    @row-del="rowDel"
    :data="data"
  >
  </avue-crud>
</template>

<script setup>
import { ref, reactive, onMounted } from "vue";
import manager from "@/options/manager";
import { ElMessageBox, ElMessage } from "element-plus";

const option = manager;
const data = ref([
  {
    id: 1,
    name: "test",
    password: "123123123",
  },
]);
const form = ref({});
const tableLoading = ref(false);

const rowSave = async (row, done, loading) => {
  //   const res = await add_msg.post("", row);
  //   if (res.code == "000000") {
  //     done();
  //     ElMessage.success("添加成功!");
  //     getList();
  //   } else {
  //     ElMessage.error("添加失败!");
  //   }
};
const rowDel = (row, index, done) => {
  ElMessageBox.confirm("此操作将永久删除该管理员, 是否继续?", "提示", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  }).then(() => {});
};
const rowUpdate = async (row, index, done, loading) => {
  //   const res = await edit_msg.post("", row);
  //   if (res.code == "000000") {
  //     done();
  //     ElMessage.success("编辑成功!");
  //     getList();
  //   } else {
  //     ElMessage.error("编辑失败!");
  //   }
};

const getManager = () => {};
</script>
